﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.Linq.Mapping;
using System.Data.Linq;

namespace PhotoGallery.Entities
{
    [Table]
    public class FavoritsPhoto
    {
        [Column(IsPrimaryKey = true, IsDbGenerated = true, AutoSync = AutoSync.OnInsert)]
        public int? Id { get; set; }

        [Column]
        public Guid UserId { get; set; }
        [Column]
        public int PhotoId { get; set; }

        private EntityRef<Image> _Image;//добавляем связь с таблицей изображений
        [Association(Name = "FK_Image_Photo", Storage = "_Image", ThisKey = "PhotoId")]
        public Image Image
        {
            get { return this._Image.Entity; }
            set { this._Image.Entity = value; }
        }
    }
}